window.callback = function(res){
        // res（未通过验证）= {ret: 1, ticket: null}
        // res（验证成功） = {ret: 0, ticket: "String", randstr: "String"}
        if(res.ret === 0){
        $('#TencentCaptcha').css('display','none');
        $('.getCodeadd').css('display','inline-block');
        $.ajax({  
            type: "GET",  
            url: "/index.php/index/RegisterAPI/codecheckimg",  
            data: {"Ticket":res.ticket,"Randstr":res.randstr},
            dataType: 'json',
            success: function (res)
            {
                if(res==1){
                 
                }
            }
        });
      }
    }
    $(".alertclose,.alertclose1").click(function(e){
        e.preventDefault();
        $("#alertkuang").hide()
        $(".zhaohuimima1").hide()
    });
    $("#found_pass").click(function(){
        $("#alert1").show()
    })
    layui.use(['layer'], function () {
        layer = layui.layer;
    });
       
    <!--密码找回手机号验证-->
    $('#phone').blur(function () {
        var phonez = $("#phone").val();
        if (phonez == '') {
            layer.msg('请输入手机号');
            return false;
        }
        var preg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(19[0-9]{1})|(16[0-9]{1})|(17[0-9]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/;
        if (!preg.test(phonez)) {
            layer.msg('请输入正确的手机号');
            return false;
        }
        $.ajax({
            url: '/index.php/index/Index/check',
            data: {'name': phonez},
            type: 'post',
            success: function (Msg) {
                if (Msg == false) {
                    layer.msg('手机号不存在，请检查或者注册');
                    $('#do').attr('disabled', true);
                    return false;
                }
            }
        });
        $('#do').attr('disabled', false);
        return false;
    });
    // 
    <!--验证码 发送验证-->
    var wait = 60;
    $(".getCodeadd").click(function () {
        var phones = $("#phone").val();
        if (phones == '') {
            layer.msg('手机号不能为空');
            return false;
        }
        //发送短信（60秒）
        $.ajax({
            type: "POST",
            url: "/index.php/index/RegisterAPI/sendregistersms",
            data: {"phone": phones},
            dataType: 'json',
            success: function (res) {
                if (res == -1) {
                    layer.msg('60内不得重新发送');
                    return false;
                }
                if (res == -2) {
                    layer.msg('错误或者超出发送限制3条/小时');
                    return false;
                }
                if (res == -3) {
                    layer.msg('您本日的找回次数上限，请明天再次尝试，如遇其他问题 请班主任老师！!');
                    $('#alert1').css('display', 'none');
                    return false;
                }
                if (res == -4) {
                    layer.msg('图片验证码错误');
                    return false;
                }
            }
        });
        time($('.getCodeadd'));
    });
    function time(o) {
        if (wait == 0) {
            o.attr("disabled", false);
            o.text("获取验证码");
            o.css('background_color', "#f4f4f4");
            wait = 60;
        } else {
            o.attr("disabled", true);
            o.text(wait + "秒后重新获取");
            o.css('backgound_color', "#8f8b8b");
            wait--;
            setTimeout(function () {
                time(o)
            }, 1000)
        }
    }
    <!--密码找回验证码验证-->
    var co = '';
    $("#code_num").blur(function () {
        $('#do').attr('disabled', false);
        var smsCodeInput = $("#code_num").val();
        $.ajax({
            type: "POST",
            url: "/index.php/index/RegisterAPI/codecheck",
            data: {"code": smsCodeInput},
            dataType: 'json',
            success: function (res) {
                if (res == -1) {
                    layer.msg('验证码错误');
                    $('#do').attr('disabled', true);
                    $('#getcode').attr('disabled', true);
                    return false;
                } else {
                    co = 1;
                }
            }
        });
    });
    var send_phone = '';
    <!--提交修改验证-->
    $('#do').click(function () {
        var user_phone = $('#phone').val();
        var user_code = $('#code_num').val();
        if (user_phone != '' && user_code != '' && co == 1) {
            send_phone = user_phone;
            $('#alert2').css('display', 'block');
        } else {
            layer.msg('请输入手机号和正确的验证码');
        }
    })
    // 
    <!--密码找回修改-->
    $('#update').click(function () {
        // 
        <!--手机密码修改-->
        var user_password = $('#pass').val();
        var reuser_password = $('#re_pass').val();
        if (user_password == '' || reuser_password == '') {
            layer.msg('请输入密码');
            return false;
        }
        if (user_password != reuser_password) {
            layer.msg('两次输入的密码不一致');
            return false;
        }
        if (user_password != '' && reuser_password != '') {
            $.post('/index.php/index/Index/update',
                {'user_password': user_password, 'reuser_password': reuser_password, 'send_phone': send_phone},
                function (data) {
                    if (data.code == 1) {
                        layer.msg(data.tips);
                        $('#alert2').css('display', 'none');
                        $('#alert1').css('display', 'none');
                        return false;
                    }
                    if (data.code == 0) {
                        layer.msg(data.tips);
                        return false;
                    }
                }, 'json')
        }
    })



    if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
                window.location.href = "http://www.yuluzhongde.com/index.php/index/login/mlogin";
            }
        layui.use(['layer'],function(){
            var layer = layui.layer
            $('#loginSubmit').click(function () {
            var phone = $("#mobileid").val();
            var password = $("#passwordid").val();
            var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(16[0-9]{1})|(17[0-9]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\d{8})$/;
            //验证
            if (phone == '') {
                layer.alert('请输入手机号', {icon: 2});
                return false;
            }
            if (password == '') {
                layer.alert('请输入密码', {icon: 2});
                return false;
            }
            if (phone.length != 11) {
                layer.alert('请输入有效手机号', {icon: 2});
                return false;
            }
            if (!myreg.test(phone)) {
                layer.alert('请输入有效手机号', {icon: 2});
                return false;
            }
            //永久登录
            var isChecked = $("#remlogin").is(":checked");
            var remlogin='';
            if(isChecked){
              $('#remlogin1').val(1);
            }else{
              $('#remlogin1').val(0);
            }
            
            data = $(".layui-form").serialize();
            $.ajax({
                type: "POST",
                url: "/index.php/index/LoginAPI/checkuser.html",
                data: data,
                dataType:'json',
                success: function (res) {
                    // return;
                    console.log(res.orderlist.length)
                    // if(res.orderlist.length!=0){
                    //     var heightbg = '160px';
                    //     var str = '<table>'
                    //     for(var i=0,l=res.orderlist.length;i<l;i++){
                    //         str += '<tr><td style="width:50%;">'+res.orderlist[i].coursename+'</td><td><a href="/index_person_setforebao.html?orderid='+res.orderlist[i].id+'">去签署</a></td></tr>'
                            
                    //     }
                    //     str += '</table>'
                    //     // res.orderlist.each(function(index,elem){
                    //     //     console.log(index)
                    //     //     console.log(elem)
                    //     // })
                    //     // alert('')
                    //     if(res.orderlist.length == 1){
                    //         heightbg = '120px';
                    //     }
                    //     if(res.orderlist.length == 2){
                    //         heightbg = '160px';
                    //     }
                    //     layer.open({
                    //       type: 1,
                    //       title:'您有协议未签署！',
                    //       // skin: 'layui-layer-rim', //加上边框
                    //       area: ['420px', heightbg], //宽高
                    //       content: str,
                    //       cancel:function(){
                    //         window.location.href="/index.php/index/Whiteprofile/index.html";
                    //       }
                    //     });
                    //     return false;
                    // }
                    // return;
                    if (res.code==0) {
                        layer.msg('登录成功');
                        window.location.href="/index.php/study_Index_index.html";
                    }else if (res.code==9) {
                        layer.msg('登录成功');
                        window.location.href="/index.php/study_Index_index.html";
                    }else {
                        layer.alert('用户名或密码错误!', {icon: 2});
                        return false;
                    }
                }
            });
        });
        })